package com.study.controller;

import com.study.entity.InfoCount;
import com.study.entity.Result;
import com.study.service.ClazzService;
import com.study.service.EmpService;
import com.study.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

@RequestMapping("/report")
@RestController
public class ReportController {
    @Autowired
    private EmpService empService;
    @Autowired
    private StudentService studentService;
    @Autowired
    private ClazzService clazzService;


    @GetMapping("/empGenderData")
    public Result empGenderCount() {
        List<Map<String, Object>> list;
        list = empService.countGender();
        return Result.success(list);
    }

    @GetMapping("/empJobData")
    public Result jobCount() {
        Map<String, Object[]> map;
        map = empService.countJob();
        return Result.success(map);
    }

    @GetMapping("/studentDegreeData")
    public Result degreeData() {
        List<Map<String, Object>> list;
        list = studentService.degreeCount();
        return Result.success(list);
    }

    @GetMapping("/studentCountData")
    public Result stuDataCount(){
        Map<String, Object[]> map;
        map = clazzService.countNum();
        return Result.success(map);
    }
}
